home *** CD-ROM | disk | FTP | other *** search
- Path: news1.h1.usa.pipeline.com!usenet
- From: grantp@usa.pipeline.com(Pete)
- Newsgroups: comp.lang.c++
- Subject: Re: "new" creams data structure -- why?
- Date: 2 Feb 1996 00:14:42 GMT
- Organization: Kalevi, Inc.
- Message-ID: <4erl1i$oas@news1.usa.pipeline.com>
- NNTP-Posting-Host: pipe8.h1.usa.pipeline.com
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete)
- X-Newsreader: Pipeline USA v3.3.0
-
- On Feb 01, 1996 23:08:16 in article <"new" creams data structure -- why?>,
- '<73067.3334@compuserve.com>' wrote:
-
-
- >
- >dear experts: why would the following line alloc memory where there is
- >insufficient space for it? when i memcpy to clear the string, it wipes
- out
- >a data structure i needed. the line is
- >
- >char* somestring = new char [300];
- >
- >when it's my fault i can deal with it, but how do i prevent this? or is
- it
- >a scoping problem or something?
- >
- >many thanks for any ideas.
-
- If operator new fails -- assuming it's the default
- global one -- it returns 0. If you don't test for it, then it's
- your fault. But I suspect the problem is elsewhere.
-
- Post a sample program that demonstrates the problem you're
- experiencing.
-
- --
- Pete Grant
- Kalevi, Inc.
- Object Oriented Software Development
-